load("@rules_cc//cc:defs.bzl", "cc_binary")
load("@rules_cc//cc:defs.bzl", "cc_proto_library") 
load("@rules_proto//proto:defs.bzl", "proto_library") 

cc_proto_library( 
    name = "runtime_test_cc_pb", 
    deps = [":runtime_test_pb"], 
) 
proto_library( 
    name = "runtime_test_pb", 
    srcs = ["demo/test.proto"], 
)

cc_binary(
    name = "runtime_component_demo",
    srcs = glob(
        [
            "demo/component_demo.cc",
            "src/*.h"
        ]
    ),
    linkopts = [
        "-pthread -lz -lrt -luuid"
    ],
    deps = [
        "@protobuf_import//:protobuf_import",
        "@com_google_googletest//:gtest_main",
        "@com_github_google_glog//:glog",
        "@com_github_gflags_gflags//:gflags",
        "@airosrt//:airosrt",
        "@fastrtps//:fastrtps",
        "runtime_test_cc_pb"
    ]
)

cc_binary(
    name = "runtime_node_demo",
    srcs = glob([
        "demo/node_demo.cc",
        "src/*.h"
    ]),
    linkopts = [
        "-pthread -lz -lrt -luuid"
    ],
    deps = [
        "@protobuf_import//:protobuf_import",
        "@com_google_googletest//:gtest_main",
        "@com_github_google_glog//:glog",
        "@com_github_gflags_gflags//:gflags",
        "@airosrt//:airosrt",
        "@fastrtps//:fastrtps",
        "runtime_test_cc_pb"
    ]
)

cc_binary(
    name = "runtime_listener_demo",
    srcs = glob([
        "demo/node_listener_demo.cc",
        "src/*.h"
    ]),
    linkopts = [
        "-pthread -lz -lrt -luuid"
    ],
    deps = [
        "@protobuf_import//:protobuf_import",
        "@com_google_googletest//:gtest_main",
        "@com_github_google_glog//:glog",
        "@com_github_gflags_gflags//:gflags",
        "@airosrt//:airosrt",
        "@fastrtps//:fastrtps",
        "runtime_test_cc_pb"
    ]
)

cc_binary(
    name = "runtime_talker_demo",
    srcs = glob([
        "demo/node_talker_demo.cc",
        "src/*.h"
    ]),
    linkopts = [
        "-pthread -lz -lrt -luuid"
    ],
    deps = [
        "@protobuf_import//:protobuf_import",
        "@com_google_googletest//:gtest_main",
        "@com_github_google_glog//:glog",
        "@com_github_gflags_gflags//:gflags",
        "@airosrt//:airosrt",
        "@fastrtps//:fastrtps",
        "runtime_test_cc_pb"
    ]
)

cc_test(
    name="runtime_ut",
    srcs = glob(["ut/runtime_test.cc",
        "src/*.h"]),
    linkopts = [
        "-pthread -lz -lrt -luuid"
    ],
    deps=[
        "@protobuf_import//:protobuf_import",
        "@com_google_googletest//:gtest_main",
        "@com_github_google_glog//:glog",
        "@com_github_gflags_gflags//:gflags",
        "@airosrt//:airosrt",
        "@fastrtps//:fastrtps"
    ],
    copts = [
        "-DUSE_CYBERRT"
    ]
)